package com.peter.ultimatebar.rom

import android.content.Context
import android.os.Build
import androidx.annotation.RequiresApi
import com.peter.ultimatebar.extension.commonNavigationBarExist

abstract class BaseRom: Rom {

    private var navExist: Boolean? = null

    @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    override fun navigationBarExist(context: Context): Boolean {
        if (navExist == null) {
            navExist = if (fullScreenGestureOn(context)) {
                screenIndicatorOn(context)
            } else {
                context.commonNavigationBarExist()
            }
        }
        return navExist!!
    }

    // 是否开启了全面屏手势
    @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    protected abstract fun fullScreenGestureOn(context: Context): Boolean

    // 是否开启了手势提示线
    @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    protected open fun screenIndicatorOn(context: Context): Boolean = false

}